<?php 
namespace Admin\Controller;
use Think\Controller;
class ModelController extends Controller{
	public function index(){
		// p(F('m'));
		$Model=D('Md');
		$data=$Model->select();
		$arr=array();
		foreach ($data as $key => $value) {
			$arr[$value['mid']]=$value;
		}
		$this->shuju=json_encode($arr);
		$this->assign('data',$arr);
		$this->display();
	}
	//添加模型
	public function add(){

		// dump($_POST);exit;
		$Model=D('Md');
		if($Model->d()){
			
			$this->success('添加成功');
		}else{
			$this->error('添加失败');
		}
	}
	//修改模型
	public function edit(){
		$Model=D('Md');
		if($Model->edit()){
			$this->success('修改成功');
		}else{
			$this->error('修改失败');
		}
	}
	//删除模型
	public function del(){
		$Model=D('Md');
		if($Model->dorp()){
			echo 1;exit;
		}else{
			echo 0;exit;
		}
	}
	//缓存
	public function updateCache(){
		$Model=D('Md');
		if($Model->updateCache()){
			echo 1;exit;
		}else{
			echo 0;exit;
		}
	}


	
}

